﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using CKQDJK;
using SuperORM;
using System.Web.Script.Services;


    /// <summary>
    /// CKQBG 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。
    [ScriptService]
    public class CKQBG : System.Web.Services.WebService
    {


        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod(EnableSession = true, Description = "业务：复制一条采矿权变更申请登记记录")]
        public bool CopyCKQBG(string project_id, string KQFWID)
        {
            ISession m_session = Session["session"] as ISession;
            if (m_session != null)
            {
                采矿申请登记[] djs = m_session.LoadEx2<采矿申请登记>("select * from 采矿申请登记 where BSM='" + KQFWID + "'", "CKQDJK");
                m_session.Delete<采矿申请登记>("PROJECT_ID='" + project_id + "'", "CKQDJK");
                m_session.Flush();
                if (djs != null && djs.Length > 0)
                {
                    采矿申请登记 dj = djs[0];
                    int oldkqfwid = dj.BSM;
                    int maxid = 0;
                    if (dj != null)
                    {
                        maxid = Helper.CommonHelper.GetMaxID(m_session, "CKQDJK", "采矿申请登记", "BSM");
                        dj.BSM = maxid;
                        int sqxh = Helper.CommonHelper.GetMaxID(m_session, "CKQDJK", "采矿申请登记", "申请序号");
                        dj.申请序号 = sqxh;
                        dj.PROJECT_ID = project_id;
                        dj.CK_GUID = Guid.NewGuid().ToString("n").ToUpper();
                        dj.项目类型 = 20;//正在办理,变更
                        //dj.XMZT = 1;
                        dj.原许可证号 = dj.许可证号;
                        dj.项目档案号 = dj.项目档案号;//.XKZH;
                        dj.项目类型 = dj.项目类型;
                        dj.原有效期起 = dj.有效期起;
                        dj.原有效期止 = dj.有效期止;
                        dj.原签发时间 = dj.签发时间;
                        dj.许可证号 = null;
                        dj.有效期限 = "0";
                        dj.审查人 = null;
                        dj.审查人意见 = null;
                        dj.复核 = null;
                       // dj.FHYJ = null;
                        dj.签发 = null;
                      //  dj.FGJZYJ = null;
                        dj.审核 = null;
                      //  dj.SHYJ = null;
                        dj.审查人意见 = null;

                        #region 乌鲁木齐采矿权

                        //dj.KGCYJ = null;
                        //dj.KGCSCR = null;
                      //  dj.DHCSCYJ = null;
                     //   dj.DHCSCR = null;
                        //dj.ZSBSCYJ = null;
                        //dj.ZSBSCR = null;
                     //   dj.GHCSCYJ = null;
                     //   dj.GHCSCR = null;
                     //   dj.FGJZYJ = null;
                        //dj.FGJZSCR = null;
                    //    dj.JZBGHYJ = null;
                    //    dj.JZBGHSCR = null;

                        #endregion

                        m_session.Save(dj, "CKQDJK");
                        m_session.Flush();
                    }
                    return true;
                }
            }
            return false;
        }
    }
